import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:myapp/app/data/repository/info_repository.dart';
import 'package:myapp/app/modules/infoList/views/info_list_view.dart';
import 'package:myapp/app/theme/app_color.dart';
import 'package:myapp/app/widget/app_tab_bar.dart';
import 'package:myapp/app/widget/home_bar.dart';
import 'package:myapp/app/widget/tab_bar_layout.dart';

import '../controllers/info_controller.dart';

class InfoView extends StatefulWidget {
  @override
  _InfoViewState createState() => _InfoViewState();
}

class _InfoViewState extends State<InfoView> with AutomaticKeepAliveClientMixin<InfoView>{

  @override
  Widget build(BuildContext context) {
    super.build(context);
    return GetBuilder<InfoController>(
      builder: (controller) {
        return TabBarLayout(controller.tabs, (index) {
          return InfoListView(index);
        }, appBar: HomeBar(),);
      },
      init: InfoController(),
      initState: (state) => {Get.put<IInfoRepository>(InfoRepository())},
    );
  }

  @override
  bool get wantKeepAlive => true;
}
